The main application of a database management system is of course to manage the storage, arrangement, and retrieval of data; however, in order to provide a variety of capabilities to the management system it is desirable to used stored procedures or predefined functions upon which the database management system can call to accomplish functions provided by these stored procedures.
The Java programming language provides a convenient language for the development of predefined functions, such as stored procedures. Java is known as an interpreted language, in that it must be interpreted (ie. translated and executed statement by statement) by the computer system on which it is run in order to be used. As is well known in the art an interpreter program may be used to translate and then execute each statement in the procedures or functions encoded in the programming language. For the Java programming language a suitable Java Interpreter would be used.
It is convenient to store executable routines such as the Java functions or procedures in a dynamic-link library (DLL) file or files. More than one function can be included in a DLL file. In the OS/2 or Windows operating systems these files typically have DLL extensions. These files are loaded only when needed by the program that calls them.
For increased speed in suitable instances functions encoded in the Java language can be compiled on the fly as compiled routines typically operate faster than corresponding interpreted routines.
There are a number of potential problems associated with using stored procedures in interpreted languages with another application such as a database management system that makes use of them.
In order to minimize facility usage such as memory it is preferable that the database system loads the required interpreter into its address space without crashing if the interpreter does not exist on the platform being addressed. It is important to determine whether a specified executable routine exists before calling it to prevent undesirable failures.
In the case of Java, which operates autonomously, there must be enough threads available for the tasks at hand but they should be reduced to a small number at other times.
One of the features of Java programming is the automatic collection of garbage objects, ie. processes or functions that are not used or have not been used for specified periods of time. This can pose a problem in database management applications where a Java object may not be called on frequently. There is a need for a long-lived Java object in certain circumstances.
Another difficulty with using Java encoded stored procedures is the difficulty in providing multiple output arguments from stored procedures.
While it is desirable to gain the advantages of Java routines there should be little or no overhead added for calling stored procedures in other languages.